← Back
Editing: index128.js
import{K as e,gq as a,M as l,G as t,c as s,gr as r,o as i,gs as o,e as n,gt as u,l as p,L as c,gu as d,fF as m,W as f,al as v}from"./utils-lib.js?v=1765440387";import{c as g,r as h,g as _,e as b,D as x,B as y,q as w,v as C,x as j,y as k,F as z,a$ as I,z as P,p as A,A as F,C as L,G as D,H as G,M as S,J as V,P as q,T as R,av as T,ax as H,bb as U,aB as E,aD as B,a5 as M}from"./base-lib.js?v=1765440387";import{u as W,r as $}from"./index25.js?v=1765440387";import{b as J,h as K,f as O}from"./form-item.js?v=1765440387";import{ag as N}from"./files.js?v=1765440387";import"./file-icon.js?v=1765440387";import{F as Q}from"./files-path.js?v=1765440387";import"./__commonjsHelpers__.js?v=1765440387";import"./useStore2.js?v=1765440387";import"./index91.js?v=1765440387";import"./useMethods.js?v=1765440387";import"./column.js?v=1765440387";import"./index94.js?v=1765440387";import"./validator.js?v=1765440387";import"./vue-virtual-scroller.esm.js?v=1765440387";import"./vue-virtual-scroller.js?v=1765440387";import"./useController4.js?v=1765440387";import"./useController5.js?v=1765440387";import"./site.js?v=1765440387";import"./useStore3.js?v=1765440387";import"./useController6.js?v=1765440387";import"./index.vue_vue_type_style_index_0_lang.js?v=1765440387";import"./add-host.vue_vue_type_script_setup_true_lang.js?v=1765440387";import"./useController2.js?v=1765440387";import"./index130.js?v=1765440387";import"./ace.js?v=1765440387";const{isSaveGitConfig:X}=W(),Y={class:"app-import-git-container"},Z=n(g({__name:"git-import",setup(n,{expose:u}){const{apphubGitConfig:p,isSaveGitConfig:c,usingHelpLink:d}=W(),m=h(!1),{BtForm:f,submit:v,param:g}=t({data:p.value||{},options:t=>_(()=>[J("Git地址","git_url",{attrs:{class:"!w-[44rem]",placeholder:"请输入Git地址"},rules:[{required:!0,message:"Git地址不能为空"}]}),J("分支","git_branch",{attrs:{class:"!w-[44rem]",placeholder:"请输入Git分支"},rules:[{required:!0,message:"分支不能为空"}]}),K(" ",()=>b("div",null,[b("span",{class:"text-primary cursor-pointer text-[12px] flex items-center",onClick:()=>m.value=!m.value},[m.value?"更多设置,点击收起":"更多设置,点击查看",b("i",{class:"ml-2 ".concat(m.value?"svgtofont-el-arrow-up":"svgtofont-el-arrow-down")},null)])]),""),...m.value?[J("用户名(可选)","name",{attrs:{class:"!w-[44rem]",placeholder:"如果是私有仓库请输入用户名",onInput:()=>{g.value.user=t.value.user}}}),J("访问令牌(可选)","password",{attrs:{class:"!w-[44rem]",placeholder:"如果是私有仓库请输入访问令牌",showPassword:!0,onInput:()=>{g.value.password=t.value.password}}})]:[],K(" ",()=>b("div",null,[b(x,{type:"default",onClick:()=>(async t=>{const{git_url:s,git_branch:r,password:i,name:o}=t.value;e({request:a({git_url:s,git_branch:r,password:i,name:o}),loading:"正在保存git配置...",message:!0,success:e=>{if(!e.status)return l.error(e.msg||"保存git配置失败");X.value=!0,l.success("保存git配置成功")}})})(g)},{default:()=>[y("保存配置")]})]),""),O(" ",[{content:b("span",null,[y("使用帮助:如果您在导入应用的过程中遇到问题,请点击 "),b(s,{href:d.value},{default:()=>["使用教程"]})])},{content:b("span",{class:"text-red-500"},[y("安全提醒:请甄别导入应用的安全性,否则将存在安全风险!")])}])]),submit:async(a,t,s)=>{const n=l.load("正在导入应用,请稍后...");try{if(await t(),!c.value)return l.error("导入失败,请先保存git配置"),!1;const a=await r();return a.status||"缺少git环境,请先安装git"!=a.msg?a.status?(l.success("导入成功"),$(!0),a.status):(l.error(a.msg||"导入失败"),!1):(null==n||n.close(),await i({title:"提示",content:"缺少git环境,是否进行安装?",icon:"warning-filled",confirmText:"安装"}),await e({request:o(),loading:"正在安装环境,请稍后...",message:!0}),!1)}catch(u){return!1}finally{null==n||n.close()}}});return u({onConfirm:v}),(e,a)=>(w(),C("div",Y,[b(j(f))]))}}),[["__scopeId","data-v-93cfa531"]]),ee={class:"app-import-check-list"},ae={class:"max-h-[32rem] overflow-auto pr-2"},le={class:"flex flex-col justify-center text-[12px] leading-[1.2]"},te={class:"mb-3 font-bold"},se={class:"mb-2 text-gray-400 break-all leading-[1.5]"},re={class:"text-gray-400"},ie=n(g({__name:"app-import-check-list",props:{list:{}},setup(e){const a=e,l=_(()=>a.list.map(e=>({appid:e.appid,apptitle:e.apptitle,appdesc:e.appdesc,appversion:e.appversion[0].m_version||""})));return(e,a)=>(w(),C("div",ee,[a[0]||(a[0]=k("div",{class:"flex items-center mb-2 text-[12px] justify-between"},[k("div",null," 应用列表 ")],-1)),k("div",ae,[(w(!0),C(z,null,I(j(l),e=>(w(),C("div",{key:e.appid,class:"flex items-center p-[1rem] mb-4 rounded-xl bg-white border border-gray-200 transition-all w-full hover:border-[#20a53a80]"},[k("div",le,[k("div",te,P(e.apptitle),1),k("div",se,P(e.appdesc),1),k("div",re,"版本:"+P(e.appversion),1)])]))),128))])]))}}),[["__scopeId","data-v-3c4ac59d"]]),oe={class:"docker-app-import-files-local-upload"},ne={class:"flex items-center mb-6"},ue={key:0},pe=n(g({__name:"local-upload",setup(a,{expose:t}){const{appList:s,onConfirm:r,openFilesUpload:i,getApphubFiles:o}=(()=>{const a=h([]),t=h([]),s=async()=>{const l=await N({path:"/tmp/apphub"}),s=["zip","tar","gz","tar.gz","tgz","rar","7z","bz2","war"],r=(l.data.files||[]).filter(e=>{if(!e.nm)return!1;const a=e.nm.toLowerCase();return s.some(e=>a.endsWith("."+e))}).map(e=>"/tmp/apphub/".concat(e.nm));a.value=r,r.length?await e({request:u({sfile:r}),loading:"正在获取应用列表,请稍后...",success:e=>{const a=e.data.data||[];let l=[];a.forEach((e,a)=>{(Array.isArray(e)?e:[e]).forEach(e=>{l.push({...e,appdesc:e.parser_from?"从上传文件解析:".concat(e.parser_from):e.appdesc||"",sfile:r[a]})})}),t.value=l}}):t.value=[]};return{fileList:a,appList:t,onConfirm:async()=>{if(!t.value.length)return l.error("应用列表为空,请上传文件"),!1;const s=await e({request:d({sfile:a.value}),loading:"正在导入应用,请稍后...",message:!0});return s.status?($(!0),!0):(l.error((null==s?void 0:s.msg)||"导入失败"),!1)},openFilesUpload:async()=>{await p({title:"上传文件到【/tmp/apphub】",area:72,component:()=>c(()=>import("./index105.js?v=1765440387"),__vite__mapDeps([]),import.meta.url),compData:{path:"/tmp/apphub"},onCancel:async()=>{await s()}})},getApphubFiles:s}})();return A(o),t({onConfirm:r}),(e,a)=>{const l=x;return w(),C("div",oe,[k("div",ne,[b(l,{type:"primary",onClick:j(i)},{default:F(()=>[...a[0]||(a[0]=[y("上传文件",-1)])]),_:1},8,["onClick"]),a[1]||(a[1]=k("span",{class:"flex items-center text-[12px] text-gray-400 ml-4"},[k("i",{class:"svgtofont-el-warning-filled mr-1 mt-[2px]"}),k("span",null,"支持 .zip, .tar.gz,.gz 格式")],-1))]),j(s).length?(w(),C("div",ue,[b(ie,{list:j(s)},null,8,["list"])])):L("",!0)])}}}),[["__scopeId","data-v-edf0b218"]]),ce={class:"docker-import-server-upload-container"},de={class:"flex items-center justify-between px-2 w-full"},me=["onClick"],fe={key:0,class:"mt-4 mb-4"},ve=n(g({__name:"server-upload",setup(a,{expose:t}){const{currentPath:s,fileList:r,selectedFiles:i,loading:o,parsedAppList:n,selectedApps:p,isSelectable:c,isChecked:f,toggleSelection:v,getIconClass:g,removeFile:_,handlePathChange:x,refresh:E,enterDir:B,onConfirm:M}=(()=>{const a=h("/tmp/apphub"),t=h([]),s=h([]),r=h(!1),i=h([]),o=h([]),n=e=>e&&e.isFile&&/\.(zip|tar|gz|tar\.gz|tgz|rar)$/i.test(e.name),p=(e,a=!1,l="")=>{const[t,s,r,i,o]=e.split(";"),n=a?(t.split(".").pop()||"").toLowerCase():"";return{name:t,mtime:s,size:r,perm:i,owner:o,isFile:a,isDir:!a,ext:n,fullpath:l.endsWith("/")?l+t:l+"/"+t}},c=async()=>{r.value=!0;const e=await m({path:a.value,disk:!1});e.data.PATH&&a.value!==e.data.PATH&&(a.value=e.data.PATH),t.value=[...(e.data.DIR||[]).map(e=>p(e,!1,a.value)),...(e.data.FILES||[]).map(e=>p(e,!0,a.value))],r.value=!1};return A(()=>{c()}),{currentPath:a,fileList:t,selectedFiles:s,loading:r,parsedAppList:i,selectedApps:o,isSelectable:n,isChecked:e=>s.value.some(a=>a.fullpath===e.fullpath),toggleSelection:async e=>{var a;if(!n(e))return;const t=s.value.findIndex(a=>a.fullpath===e.fullpath);if(t>-1)s.value.splice(t,1),i.value=i.value.filter(a=>a.fullpath!==e.fullpath);else{const t=l.load("正在解析文件中,请稍后..."),r=await u({sfile:e.fullpath}),o=Array.isArray(r.data)?r.data:(null==(a=r.data)?void 0:a.data)||[];if(!o.length||"object"!=typeof o[0]||null===o[0]||!("appid"in o[0])&&!("appname"in o[0]))return l.error("解析失败,无法从该压缩包文件中获取应用信息"),void t.close();t.close(),o.forEach(a=>{const l=a.parser_from||e.fullpath;i.value.push({...a,fullpath:l,appdesc:"从服务器文件解析:".concat(l)})}),s.value.push(e)}o.value=i.value.map(e=>e.appid)},getIconClass:e=>e.isDir?"icon-bg folder-icon":["zip","rar","7z","gz","tar.gz","tgz","war"].includes(e.ext)?"icon-bg compress-icon":"icon-bg file-icon",removeFile:e=>{s.value=s.value.filter(a=>a.fullpath!==e.fullpath),i.value=i.value.filter(a=>a.fullpath!==e.fullpath),o.value=i.value.map(e=>e.appid)},handlePathChange:e=>{a.value=e,c()},refresh:()=>{c()},enterDir:e=>{if(e.isDir){let l=a.value.replace(/\/$/,"");""===l&&(l="/"),a.value="/"===l?"/".concat(e.name):"".concat(l,"/").concat(e.name),c()}},onConfirm:async()=>{if(!i.value.length)return l.error("请选择要导入的文件"),!1;const a=await e({request:d({sfile:s.value.map(e=>e.fullpath)}),loading:"正在导入应用,请稍后...",message:!0});return a.status?($(!0),!0):(l.error((null==a?void 0:a.msg)||"导入失败"),!1)}}})();return t({onConfirm:M}),(e,a)=>{const l=R,t=T,u=H,d=U,m=D("bt-loading");return w(),C("div",ce,[b(Q,{initialPath:j(s),onPathChange:j(x),onRefresh:j(E),class:"mb-6"},null,8,["initialPath","onPathChange","onRefresh"]),G((w(),S(u,{data:j(r),"row-key":e=>e.name,"show-header":!1,height:"300",class:"server-upload-table"},{default:F(()=>[b(t,null,{default:F(({row:e})=>[k("div",de,[k("span",{onClick:a=>e.isDir&&j(B)(e),class:"flex items-center gap-2 cursor-pointer file-row files-list"},[k("i",{class:V(j(g)(e))},null,2),y(" "+P(e.name),1)],8,me),j(c)(e)?(w(),S(l,{key:0,"model-value":j(f)(e),onChange:a=>j(v)(e)},null,8,["model-value","onChange"])):L("",!0)])]),_:1})]),_:1},8,["data","row-key"])),[[m,j(o)]]),j(i).length?(w(),C("div",fe,[a[1]||(a[1]=k("div",{class:"mb-3"},"已选择的文件:",-1)),(w(!0),C(z,null,I(j(i),e=>(w(),S(d,{key:e.name,closable:"",onClose:a=>j(_)(e),class:"mr-2 mb-2"},{default:F(()=>[y(P(e.name),1)]),_:2},1032,["onClose"]))),128))])):L("",!0),j(n).length?(w(),S(ie,{key:1,list:j(n),modelValue:j(p),"onUpdate:modelValue":a[0]||(a[0]=e=>q(p)?p.value=e:null)},null,8,["list","modelValue"])):L("",!0)])}}}),[["__scopeId","data-v-c8c3a72e"]]),ge={class:"docker-app-import-files-container"},he=n(g({__name:"index",setup(e,{expose:a}){const{usingHelpLink:l}=W(),t=h("upload"),s=h(),r=h(),i=[{content:()=>b("span",null,[y("使用帮助:如果您在导入应用的过程中遇到问题,请点击 "),b("a",{class:"bt-link text-blue-500",href:l.value,target:"_blank"},[y("使用教程")])])},{content:()=>b("span",{class:"text-red-500"},[y("安全提醒:请甄别导入应用的安全性,否则将存在安全风险!")])}];return a({onConfirm:function(){var e,a,l,i,o,n;return"upload"===t.value?null!=(l=null==(a=null==(e=s.value)?void 0:e.onConfirm)?void 0:a.call(e))?l:Promise.reject(!1):null!=(n=null==(o=null==(i=r.value)?void 0:i.onConfirm)?void 0:o.call(i))?n:Promise.reject(!1)}}),(e,a)=>{const l=E,o=B,n=f;return w(),C("div",ge,[b(o,{modelValue:j(t),"onUpdate:modelValue":a[0]||(a[0]=e=>q(t)?t.value=e:null),class:"mb-4"},{default:F(()=>[b(l,{label:"上传文件",name:"upload"},{default:F(()=>[b(pe,{ref_key:"localUploadRef",ref:s},null,512)]),_:1}),b(l,{lazy:"",label:"服务器目录",name:"server"},{default:F(()=>[b(ve,{ref_key:"serverUploadRef",ref:r},null,512)]),_:1})]),_:1},8,["modelValue"]),b(n,{options:i,class:"text-[12px] text-gray-500"})])}}}),[["__scopeId","data-v-1ee657da"]]),_e={class:"p-2rem app-import-container"},be=g({__name:"index",setup(e,{expose:a}){const{activeTabs:l,isSaveGitConfig:t}=W(),s=h(),r=h();return a({onConfirm:()=>{var e,a,t,i;return"git"===l.value?null==(a=null==(e=s.value)?void 0:e.onConfirm)?void 0:a.call(e):"files"===l.value?null==(i=null==(t=r.value)?void 0:t.onConfirm)?void 0:i.call(t):void 0}}),M(()=>{t.value=!1}),(e,a)=>{const t=E,i=v;return w(),C("div",_e,[b(i,{modelValue:j(l),"onUpdate:modelValue":a[0]||(a[0]=e=>q(l)?l.value=e:null)},{default:F(()=>[b(t,{label:"从GIT导入",name:"git"},{default:F(()=>[b(Z,{ref_key:"gitImportRef",ref:s},null,512)]),_:1}),b(t,{lazy:"",label:"从文件导入",name:"files"},{default:F(()=>[b(he,{ref_key:"filesImportRef",ref:r},null,512)]),_:1})]),_:1},8,["modelValue"])])}}});export{be as default}; function __vite__mapDeps(indexes) { if (!__vite__mapDeps.viteFileDeps) { __vite__mapDeps.viteFileDeps = [] } return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) }
Save File
Cancel